package com.chub.study.modules.service.impl;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.chub.study.modules.entity.TMessage;
import com.chub.study.modules.mapper.TMessageMapper;
import com.chub.study.modules.service.TMessageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 报文表（请求报文，响应报文） 服务实现类
 * </p>
 *
 * @author Chub
 * @since 2022-11-02
 */
@Slf4j
@Service
public class TMessageServiceImpl extends ServiceImpl<TMessageMapper, TMessage> implements TMessageService {
    @Autowired
    private TMessageMapper messageMapper;

    @Override
    public TMessage saveReqMessage(TMessage msg) {
        // TMessage message = new TMessage();
        // message.setMsgId(IdUtil.simpleUUID());
        msg.setMsgContent(JSONObject.toJSONString(msg));
        log.info("报文信息-->{}", JSONObject.toJSONString(msg));
        this.save(msg);
        return msg;
    }
}
